<?php
if (!class_exists('AlfaFilter')) {


	/**
	 * @author Alecsandru Gabriel DINU
	 * @since Jun 12, 2008
	 * Filter abstract class. The other alfa filters must extend
	 * this class and implement the required methods. 
	 */
	abstract class AlfaFilter  {
		const _CHAIN = true;
		const _STOP = false;   
	  	protected $filterConfig;
		
		/**
		 * Class constructor.
		 * @access public
		 * @param AlfaFilterConfig
		 */
		public function __construct($filterConfig) {
			$this->filterConfig = $filterConfig;
		}
		
		/**
		 * Performs initialization.
		 * @access public
		 */
		public function init() {}

		
		/**
		 * Class destructor.
		 * @access public
		 */
		public function __destruct() {
			$this->filterConfig = null;
		}
		
		/**
		 * Returns the filter config.
		 * @access public
		 * @return AlfaFilterConfig 
		 */
		public function getFilterConfig() {
			return $this->filterConfig;
		}
		
		/**
		 * Performs the filtering.
		 * @access public
		 * @param Context
		 * @param AlfaFilterChain
		 */
		public abstract function doFilter(Context $context, AlfaFilterChain $chain);
		
	}
}